<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>  
<%@ include file="/jsp/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"/>
<script>
	function submit(){
		$("#form1").submit();
}
</script>
    <title>My JSP 'treelist.jsp' starting page</title>  
      
    <link rel="stylesheet" href="${path}/static/zTree/css/demo.css" type="text/css">  
    <link rel="stylesheet" href="${path}/static/zTree/css/zTreeStyle/zTreeStyle.css" type="text/css">
    <script type="text/javascript" src="${path}/static/zTree/js/jquery-1.4.4.min.js"></script>  
    <script type="text/javascript" src="${path}/static/zTree/js/jquery.ztree.core-3.5.min.js"></script>  
    <script type="text/javascript" src="${path}/static/zTree/js/jquery.ztree.excheck-3.5.min.js"></script>  
      
      
    <SCRIPT type="text/javascript">  
        var setting = {  
            check: {  
                enable: false
                
            },  
            data: {  
                simpleData: {  
                    enable: true  
                }  
            }
            ,callback: {
        		onClick: zTreeOnClick
        		  
        	}
        };  
  
        var zNodes ;  
          
          
        var code;  
      
        function setCheck() {  
          
            var zTree = $.fn.zTree.getZTreeObj("treeList"),  
            py = $("#py").attr("checked")? "p":"",  
            sy = $("#sy").attr("checked")? "s":"",  
            pn = $("#pn").attr("checked")? "p":"",  
            sn = $("#sn").attr("checked")? "s":"",  
            type = { "Y":py + sy, "N":pn + sn};  
            zTree.setting.check.chkboxType = type;  
            showCode('setting.check.chkboxType = { "Y" : "' + type.Y + '", "N" : "' + type.N + '" };');  
        }  
        function showCode(str) {  
            if (!code) code = $("#code");  
            code.empty();  
            code.append("<li>"+str+"</li>");  
        }  
          
      
        function fuzhi(data){  
              
          
            zNodes=eval("("+data+")");  
          
              
            $.fn.zTree.init($("#treeList"), setting, zNodes);  
          
            setCheck();  
            $("#py").bind("change", setCheck);  
            $("#sy").bind("change", setCheck);  
            $("#pn").bind("change", setCheck);  
            $("#sn").bind("change", setCheck);  
              
          
        }  
          
        $(document).ready(function(){  
              
          
        $.get("${path}/monitoring/treeList.do",function(data){  
          
            $('#result').text(data);//直接展示JSON数据  
            fuzhi(data);  
              
            });  
  
        });  
        function zTreeOnClick(event, treeId, treeNode) {
        	$.ajax({
                type: "POST",
                url: "${path}/monitoring/audioListbyOid.do",
                data: {compid:treeNode.id},
                dataType: "json",
                success: function(data){
                	$("#xinhaoyuan").empty();
                	//循环对象
                	var str="";
                	if(data.list.length>0){
                		for(var i=0;i<data.list.length;i++){
                    		str=str+"<option value="+data.list[i].audioAddress+">"+data.list[i].audioName+"</option>";
                    	
                		}
                    	$("#xinhaoyuan").append(str);
                	}else{
                		alert("暂无数据,请联系管理员!");
                	}
                }
            });
        };
       
         //要执行的方法
        function aaa(){
        	var treeObj = $.fn.zTree.getZTreeObj("treeList");
        	
        	}
        
        
    </SCRIPT>
  </head>  
    
  <body onload="aaa()"> 
     <section class="rt_wrap content mCustomScrollbar" style="margin-top:10px;">
      <div class="page_title" style="padding-bottom: 10px">
      <form>
	      <span>
		       信号源：<select class="textbox textbox_225" id="xinhaoyuan" name="searchType">
		      </select>
	      </span>
      </form>   	
</section>   
    <div class="zTreeDemoBackground left">  
        <ul id="treeList" class="ztree"></ul>  
    </div> 
 
  </body>  
</html>  